package com.ecfront.dao.impl;

import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.ecfront.dao.ShopStyleDAO;
import com.ecfront.pojo.ShopStyle;


/**
 * @version 1.0
 * @author www.ecfrom.com
 */

public class ShopStyleDAOImpl extends HibernateDaoSupport implements ShopStyleDAO {

	protected void initDao() {}

	public void save(ShopStyle transientInstance) {
		getHibernateTemplate().saveOrUpdate(transientInstance);
	}

	public void delete(ShopStyle persistentInstance) {
		getHibernateTemplate().delete(persistentInstance);
	}

	public ShopStyle findById(java.lang.Integer id) {
		ShopStyle instance = (ShopStyle) getHibernateTemplate().get(
					"com.ecfront.pojo.ShopStyle", id);
		return instance;

	}

	public List findByExample(ShopStyle instance) {
		List results = getHibernateTemplate().findByExample(instance);
		return results;
	}


	public List findByProperty(String propertyName, Object value) {
		String queryString = "from ShopStyle as model where model."
					+ propertyName + "= ?";
		return getHibernateTemplate().find(queryString, value);
	}

	public List findBySstTitle(Object sstTitle) {
		return findByProperty(SST_TITLE, sstTitle);
	}

	public List findBySstFileUrl(Object sstFileUrl) {
		return findByProperty(SST_FILE_URL, sstFileUrl);
	}

	public List findAll() {
		String queryString = "from ShopStyle";
		return getHibernateTemplate().find(queryString);
	}

	public static ShopStyleDAO getFromApplicationContext(ApplicationContext ctx) {
		return (ShopStyleDAO) ctx.getBean("ShopStyleDAO");
	}
}